#include "gtktooltipprivate.h"
#include "gtktypebuiltins.h"
#include "gtkversion.h"
-#include "gtkwidgetpaintable.h"
+#include "gtkwidgetpaintableprivate.h"
#include "gtkwidgetpathprivate.h"
#include "gtkwindowgroup.h"
#include "gtkwindowprivate.h"
return;
for (l = priv->paintables; l; l = l->next)
- gdk_paintable_invalidate_contents (l->data);
+ gtk_widget_paintable_invalidate_contents (l->data);
}
static void
GSList *l;
for (l = priv->paintables; l; l = l->next)
- gdk_paintable_invalidate_size (l->data);
+ gtk_widget_paintable_invalidate_size (l->data);
}
/**
priv->alloc_needed = FALSE;
priv->alloc_needed_on_child = FALSE;
+ gtk_widget_invalidate_paintable_size (widget);
+
check_clip:
if (position_changed || size_changed || baseline_changed)
gtk_widget_queue_draw (widget);
#include "config.h"
-#include "gtkwidgetpaintable.h"
+#include "gtkwidgetpaintableprivate.h"
#include "gtkintl.h"
#include "gtksnapshot.h"
GtkWidget *widget;
guint loop_tracker;
+
+ guint size_invalid : 1;
+ guint contents_invalid : 1;
};
struct _GtkWidgetPaintableClass
GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (paintable);
graphene_matrix_t transform;
+ self->contents_invalid = FALSE;
+
if (self->widget == NULL ||
!_gtk_widget_is_drawable (self->widget) ||
_gtk_widget_get_alloc_needed (self->widget))
static GdkPaintable *
gtk_widget_paintable_paintable_get_current_image (GdkPaintable *paintable)
{
+ GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (paintable);
+
+ self->contents_invalid = FALSE;
+ self->size_invalid = FALSE;
+
g_warning ("FIXME: Implement once we can create paintables from render nodes");
return NULL;
{
GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (paintable);
+ self->size_invalid = FALSE;
+
if (self->widget == NULL)
return 0;
{
GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (paintable);
+ self->size_invalid = FALSE;
+
if (self->widget == NULL)
return 0;
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
+void
+gtk_widget_paintable_invalidate_size (GtkWidgetPaintable *self)
+{
+ if (self->size_invalid)
+ return;
+ self->size_invalid = TRUE;
+ gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
+}
+
+void
+gtk_widget_paintable_invalidate_contents (GtkWidgetPaintable *self)
+{
+ if (self->contents_invalid)
+ return;
+
+ self->contents_invalid = TRUE;
+ gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
+}
--- /dev/null
+/*
+ * Copyright © 2018 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte@gnome.org>
+ */
+
+#ifndef __GTK_WIDGET_PAINTABLE_PRIVATE_H__
+#define __GTK_WIDGET_PAINTABLE_PRIVATE_H__
+
+#include "gtkwidgetpaintable.h"
+
+
+void gtk_widget_paintable_invalidate_size (GtkWidgetPaintable *self);
+void gtk_widget_paintable_invalidate_contents (GtkWidgetPaintable *self);
+
+
+#endif /* __GTK_WIDGET_PAINTABLE_PRIVATE_H__ */